package com.zw.transition.mapper;


import com.zw.transition.entity.*;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

/**
 * @Description: 派工单转序 数据层
 *
 * @Author: China.wsg
 * @Date: 2021/05/13 16:11
 */
public interface AssemblyMapper {

    AssemblySheet findSheet(QrParse parse);

    List<AssemblyRoute> findApplyList(QrParse parse);
    List<AssemblyRoute> findCompleteApplyList(QrParse parse);
    List<AssemblyRoute> findCompleteApplyList1(QrParse parse);
    List<AssemblyRoute> findCompleteApplyList2(QrParse parse);

    List<AssemblyModel> findCheckList(QrParse parse);

    List<AssemblyModel> findRecList(QrParse parse);

    int updateRouteApply(AssemblyRoute route);

    int updateAsseRouteStatusExe(AssemblyRoute route);

    AssemblyRoute getAssemblyRouteByPrimaryKey(Integer id);

    int addTrans(AssemblyTransSheet trans);
    int addTransCheck(AssemblyTransCheck transCheck);

    List<AssemblyModel> findHisApplyList(String code);

    AssemblyTransSheet getTransSheet(Integer id);
    AssemblyTransCheck getTransSheetCheck(Integer id);

    AssemblyRoute findCurRoute(AssemblyTransSheet trans);

    int updateRouteApplyToCancelApply(AssemblyRoute route);

    int updateTransIsdel(@Param("id") Integer id, @Param("isDel") Integer isDel);

    int updateRouteStatusNotStarted(Integer routeId);

    int updateRouteDel(AssemblyRoute route);

    int updateTransStatus(@Param("id") Integer id, @Param("status") Integer status);

    AssemblySheet getSheet(AssemblyRoute route);

    int updateSheetInvalid(AssemblySheet sheet);
    int updateRejectTrans(AssemblyTransCheck t);

    List<AssemblyModel> findHisCheckList(String code);

    AssemblyRoute findNextRoute(AssemblyRoute route);

    int updateRouteCheck(AssemblyRoute cur);
    int updateCheckTrans(AssemblyTransCheck trans);
    int updateSheetTrans(AssemblyTransSheet trans);
    int updateRouteRecNum(AssemblyRoute route);

    int udpAsseStoreBySheetId(AssemblyStore asseStore);

    AssemblyStore findStoreBySheetId(Integer sheetId);

    AssemblyStoreRecord findStoreRecordById(Integer id);

    void insertStoreRecord(AssemblyStoreRecord record);

    void insertStore(AssemblyStore store);
    int updateStore(AssemblyStore store);

    int updateRecSheetTrans(AssemblyTransSheet trans);

    List<AssemblyModel> findHisRecList(String code);

    /**
     * @param prodNo 生产令编号
     * @Author wsg
     * @Date 13:29 2021/6/8
     * @Description 取得生产令生产、装配、安装状态
     **/
    ProdTasStatus getProdTasStatusByProdNo(String prodNo);

    /**
     * @param prodNo 生产令编号
     * @param status 状态 0=未完成，1=已完成
     * @Author wsg
     * @Date 13:29 2021/6/8
     * @Description 更新生产令生产完成状态
     **/
    Integer udpCodStaAndDate(@Param("prodNo") String prodNo, @Param("status") Integer status, @Param("comDat") Date comDat);

    /** 取得机械和流体未完成工艺卡装配数 */
    Integer getJxLtNotTranCompCount(String prodNo,Integer sheetId);

    /** 更新生产令装配任务状态 */
    int updateProdTasProtStaByProdNo(ProdTasStatus prodTas);

    /** 更新生产令装配任务开始时间及状态 */
    int updateProdTasStartProtStaByProdNo(ProdTasStatus prodTas);

}
